﻿Public Structure Artist
	Dim name As String
	Dim mbid As String
	Dim url As String
	Dim image_small As String
	Dim image() As String
	Dim streamable As String
	Dim similar() As Artist
	Dim bio As Bio
	Dim stats As Stats
	Dim tags() As Tag


	Public Sub New(ByRef xmlArtist As XElement)
		parseXML(xmlArtist)
	End Sub

	Public Sub parseXML(ByRef xmlArtist As XElement)
		Dim count As Integer

		If xmlArtist.HasAttributes() Then

		End If

		If (xmlArtist.<name>.Count > 0) Then
			name = xmlArtist.<name>.Value
		End If
		If (xmlArtist.<mbid>.Count > 0) Then
			mbid = xmlArtist.<mbid>.Value
		End If
		If (xmlArtist.<url>.Count > 0) Then
			url = xmlArtist.<url>.Value
		End If
		If (xmlArtist.<image_small>.Count > 0) Then
			image_small = xmlArtist.<image_small>.Value
		End If
		If (xmlArtist.<stats>.Count > 0) Then
			stats = New Stats(xmlArtist.<stats>(0))
		End If
		If (xmlArtist.<bio>.Count > 0) Then
			bio = New Bio(xmlArtist.<bio>(0))
		End If
		If (xmlArtist.<streamable>.Count > 0) Then
			streamable = xmlArtist.<streamable>.Value
		End If

		count = xmlArtist.<image>.Count()
		If (count > 0) Then
			ReDim image(0 To count - 1)
			For i As Integer = 0 To count - 1
				image(i) = xmlArtist.<image>(i).Value
			Next
		End If

		count = xmlArtist.<similar>.Count()
		If (count > 0) Then
			count = xmlArtist.<similar>.<artist>.Count()
			If (count > 0) Then
				ReDim similar(count - 1)
				For i As Integer = 0 To count - 1
					similar(i) = New Artist(xmlArtist.<similar>.<artist>(i))
				Next
			End If
		End If

		count = xmlArtist.<tags>.Count()
		If (count > 0) Then
			ReDim tags(count - 1)
			For i As Integer = 0 To count - 1
				tags(i) = New Tag(xmlArtist.<tags>.<tag>(i))
			Next
		End If
	End Sub
End Structure
